package com.zzptc.easyshop.service;

import com.zzptc.easyshop.dao.ProductDao;
import com.zzptc.easyshop.factory.DaoFactoryImp;
import com.zzptc.easyshop.factory.IFactory;
import com.zzptc.easyshop.vo.Good;
import com.zzptc.easyshop.vo.VO;

import java.sql.SQLException;
import java.util.List;

/**
 * 业务层  用户提出的需求
 */
public class ProductServiceImp implements IService {
    @Override
    public boolean insert(VO vo) throws SQLException {
        return false;
    }

    /**
     * 获取所有的商品类型
     * @return
     * @throws SQLException
     */
    @Override
    public List getAll() throws SQLException {
        List<Good> list=null;
        //创建DAO
        try {
            ProductDao dao= (ProductDao) DaoFactoryImp.getInstance().createDAO("productdao");
            list=dao.getAll();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }

    @Override
    public boolean deleteByID(VO vo) throws SQLException {
        return false;
    }

    @Override
    public boolean update(VO vo) throws SQLException {
        return false;
    }

    @Override
    public VO getByID(VO vo) throws SQLException {
        return null;
    }
}
